﻿Imports ajayumi.develop.win32.GRssReader.Google.Reader
Imports System.IO
Imports System.Text
Imports System.Threading.Tasks
Imports ajayumi.develop.win32.GRssReader.Service.Model
Imports System.ServiceModel.Syndication
Imports System.Xml
Imports System.ComponentModel
Imports System.Net

Public Class OfflineFeedService
    Inherits FeedServiceBase


#Region "Variables"
    Private m_ArticleImageInfoList As List(Of ArticleImageInfo) = Nothing
    Private m_Node As TreeNode = Nothing

#End Region

#Region "Properties"

    Public ReadOnly Property [Node]() As TreeNode
        Get
            Return Me.m_Node
        End Get
    End Property

#End Region

    Public Sub New(node As TreeNode, subscriptionInfo As SubscriptionInfo)
        MyBase.New(subscriptionInfo)
        Me.m_Node = node
        Me.m_ArticleImageInfoList = New List(Of ArticleImageInfo)()
    End Sub

    Public Overrides Sub Clear()
        Dim _Directory As String = GetSubscriptionImageCacheFolder(Me.SubscriptionInfo)
        Directory.Delete(_Directory, True)
    End Sub


    Public Overloads Overrides Sub GetArticleInfos(count As Integer)
        Dim _Error As Exception = Nothing
        Try
            Dim _ArticleInfos As IEnumerable(Of ArticleInfo) = _
                                    o_ReaderService.GetArticleInfos(SubscriptionInfo, count)

            Me.m_ArticleInfoList = _ArticleInfos.ToList()
        Catch ex As Exception
            _Error = ex
        End Try

        Me.OnGetArticleCompleted(New GetArticleInfoListCompleted(Me.m_ArticleInfoList, _Error, False, Me))
    End Sub



End Class
